package leet.ku._83;

class ListNode {
	int val;
	ListNode next;

	ListNode(int x) {
		val = x;

	}
}

public class Solution {
	public ListNode deleteDuplicates(ListNode head) {
		ListNode ans = new ListNode(-1);
		ListNode pAns = ans;
		while (head != null) {
			if (head.next == null || head.next != null && head.val != head.next.val) {
				pAns.next = head;
				pAns = head;
			}
			head = head.next;
		}
		return ans.next;
	}
}